package main;

import render.Camera;
import render.Light;
import render.Material;
import render.Plane;
import render.Primitive;
import render.Scene;
import render.Sphere;

/**
 * simple test scene inspired by that one: http://upload.wikimedia.org/wikipedia/de/0/0e/Box_-_Path_Tracing_High.png
 * 
 * @author Robbe
 *
 */
public class SampleScene extends Scene {
	
	public SampleScene() {
		// create materials		
		Material white = new Material(
				"white",
				new double[]{1.0f, 1.0f, 1.0f},
				new double[]{1.0f, 1.0f, 1.0f},
				new double[]{1.0f, 1.0f, 1.0f},
				new double[]{0,0,0},
				0,0,3
		);	
		
		Material lightGray = new Material(
				"white",
				new double[]{0.82f, 0.82f, 0.82f},
				new double[]{0.82f, 0.82f, 0.82f},
				new double[]{0.82f, 0.82f, 0.82f},
				new double[]{0,0,0},
				0,0,3
		);		
		
		Material gray = new Material(
				"white",
				new double[]{0.68f, 0.68f, 0.68f},
				new double[]{0.68f, 0.68f, 0.68f},
				new double[]{0.68f, 0.68f, 0.68f},
				new double[]{0,0,0},
				0,0,3
		);	
		
		Material darkGray = new Material(
				"white",
				new double[]{0.57f, 0.57f, 0.57f},
				new double[]{0.57f, 0.57f, 0.57f},
				new double[]{0.57f, 0.57f, 0.57f},
				new double[]{0,0,0},
				0,0,3
		);		
		
		Material orange = new Material(
				"orange",
				new double[]{0.85f,0.47f,0},
				new double[]{0.85f,0.47f,0},
				new double[]{0.85f,0.47f,0},
				new double[]{0,0,0},
				0,0,100
		);
		
		Material blue = new Material(
				"blue",
				new double[]{0.21f,0.62f,0.73f},
				new double[]{0.21f,0.62f,0.73f},
				new double[]{0.21f,0.62f,0.73f},
				new double[]{0,0,0},
				0,0,3
		);
		
		Material chrome = new Material(
				"chrome",
				new double[]{0,0,0},
				new double[]{0,0,0},
				new double[]{1,1,1},
				new double[]{0,0,0},
				0.8,0,1000
		);		
		
		Material glass = new Material(
				"glass",
				new double[]{1,1,1},
				new double[]{1,1,1},
				new double[]{1,1,1},
				new double[]{0,0,0},
				0, 0.5, 1000
		);	
		
		// create camera		
		camera = new Camera(
				new double[]{0,0,2},
				new double[]{0,0,-1},
				new double[]{0,1,0},
				60  * (Math.PI/180), // 60 degrees
				640.0/480.0
		);
		
		// create primitives
		primitives = new Primitive[10];
		
		primitives[0] = new Plane(new double[]{1,0,0},2,orange); // left wall
		primitives[1] = new Plane(new double[]{-1,0,0},2,blue); // right wall
				
		primitives[2] = new Plane(new double[]{0,1,0},2,darkGray); // ceiling
		primitives[3] = new Plane(new double[]{0,-1,0},2,orange); // bottom
		
		primitives[4] = new Plane(new double[]{0,0,1},10,gray); // front wall
		primitives[5] = new Plane(new double[]{0,0,-1},5,gray); // back wall
		
		primitives[6] = new Sphere(0.9,new double[]{-1,1,-6},chrome); // ball 1
		primitives[7] = new Sphere(0.9,new double[]{1,1,-4},glass); // ball 2
		
		primitives[8] = new Sphere(0.9,new double[]{-1,1,-2},chrome); // ball 3
		primitives[9] = new Sphere(0.9,new double[]{1,1,0},glass); // ball 4
			
		
		//primitives[8] = new Sphere(1,new double[]{0,-2,-3},white,true); // lamp
		
		// create lights
		lights = new Light[4];
		lights[0] = new Light(new double[]{-1,-1.5,-8}, new double[]{0.75, 0.25, 0.25},0.5,0.5);
		lights[1] = new Light(new double[]{1,-1.5,-5}, new double[]{0.25, 0.75, 0.25},0.5,0.5);
		lights[2] = new Light(new double[]{0,-1.5,-2}, new double[]{0.25, 0.25, 0.75},0.5,0.5);
		lights[3] = new Light(new double[]{0,0,0}, new double[]{1, 1, 1}, 0.3,0.5);
		ambient = new double[]{0.1, 0.1, 0.1};
		
		background = new double[]{0.5, 0.5, 0.5};
		shadowStrength = 0.9;

	}

}
